/**
 * 
 */
package com.mobile2you.nci.android.domain;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author JBromo
 * 
 */
public class Annuaires implements Comparable<Annuaires> {

	private String activity;
	private String centre;
	private String create;
	private int id;
	private String image;
	private String responsible;
	private String text;
	private String title;
	private String update;
	private String web;

	public Annuaires(JSONObject object) throws JSONException {

		activity = object.getString("activity");
		centre = object.getString("centre");
		// create = object.getString("create");
		id = object.getInt("id");
		image = object.getString("image");
		responsible = object.getString("responsible");
		text = object.getString("text");
		title = object.getString("title");
		update = object.getString("updated_at");
		web = object.getString("web");

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	@Override
	public int compareTo(Annuaires another) {
		return title.compareTo(another.title);
	}

	/**
	 * @return the activity
	 */
	public String getActivity() {
		return activity;
	}

	/**
	 * @return the centre
	 */
	public String getCentre() {
		return centre;
	}

	/**
	 * @return the create
	 */
	public String getCreate() {
		return create;
	}

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @return the image
	 */
	public String getImage() {
		return image;
	}

	public String getImageURL() {
		return "http://nci.m2y.fr/images/annuaire/" + image;
	}

	/**
	 * @return the responsible
	 */
	public String getResponsible() {
		return responsible;
	}

	/**
	 * @return the text
	 */
	public String getText() {
		return text;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @return the update
	 */
	public String getUpdate() {
		return update;
	}

	/**
	 * @return the web
	 */
	public String getWeb() {
		return web;
	}

	public void set(JSONObject object) throws JSONException {
		activity = object.getString("activity");
		centre = object.getString("centre");
		create = object.getString("create_at");
		id = object.getInt("id");
		image = object.getString("image");
		responsible = object.getString("responsible");
		text = object.getString("text");
		title = object.getString("title");
		update = object.getString("update_at");
		web = object.getString("web");
	}

	/**
	 * @param activity
	 *            the activity to set
	 */
	public void setActivity(String activity) {
		this.activity = activity;
	}

	/**
	 * @param centre
	 *            the centre to set
	 */
	public void setCentre(String centre) {
		this.centre = centre;
	}

	/**
	 * @param create
	 *            the create to set
	 */
	public void setCreate(String create) {
		this.create = create;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @param image
	 *            the image to set
	 */
	public void setImage(String image) {
		this.image = image;
	}

	/**
	 * @param responsible
	 *            the responsible to set
	 */
	public void setResponsible(String responsible) {
		this.responsible = responsible;
	}

	/**
	 * @param text
	 *            the text to set
	 */
	public void setText(String text) {
		this.text = text;
	}

	/**
	 * @param title
	 *            the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @param update
	 *            the update to set
	 */
	public void setUpdate(String update) {
		this.update = update;
	}

	/**
	 * @param web
	 *            the web to set
	 */
	public void setWeb(String web) {
		this.web = web;
	}

}
